/*
package com.ygy.yfzx.license.listener;

import com.ygy.yfzx.license.LicenseVerify;
import com.ygy.yfzx.license.config.LicenseProperties;
import com.ygy.yfzx.license.data.LicenseVerifyParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

*/
/**
 * 在项目启动时安装证书
 *//*



public class LicenseCheckListener implements ApplicationListener<ApplicationStartedEvent> {

    private LicenseProperties licenseProperties;


    @Override
    public void onApplicationEvent(ApplicationStartedEvent event) {
        //root application context 没有parent
        ApplicationContext context = event.getApplicationContext().getParent();
        System.out.println("++++++++ 开始安装证书 " + licenseProperties.toString());
        if (context == null) {
            if ((null != licenseProperties.getLicensePath())) {
                System.out.println("++++++++ 开始安装证书 ++++++++");
                LicenseVerifyParam param = new LicenseVerifyParam();
                param.setSubject(licenseProperties.getSubject());
                param.setPublicAlias(licenseProperties.getPublicAlias());
                param.setStorePass(licenseProperties.getStorePass());
                param.setLicensePath(licenseProperties.getLicensePath());
                param.setPublicKeysStorePath(licenseProperties.getPublicKeysStorePath());
                LicenseVerify licenseVerify = new LicenseVerify();
                //安装证书
                licenseVerify.install(param);
                System.out.println("++++++++ 证书安装结束 ++++++++");
            } else {
                System.out.println("++++++++ 开始安装证书 licensePath=null ++++++++");
            }
        } else {
            System.out.println("++++++++ 开始安装证书 context=null ++++++++");
        }
    }
}

*/
